package models

import (
	"github.com/jinzhu/gorm"
	"kop/modules/ranking/entity"
)

func InitPopularity(dB *gorm.DB, roleID, serverID int32) entity.Popularity {

	var data = entity.Popularity{
		RoleID:   roleID,
		ServerID: serverID,
	}
	if err := dB.FirstOrCreate(&data).Error; err != nil {
		panic(err)
	}

	return data
}
